/*
 *	Copyright © 2013 Changsha kk Network Technology Co., Ltd. All rights reserved.
 *	长沙市师说网络科技有限公司 版权所有
 *	http://www.kk.com
 */

package com.hlingsoft.kkh.entity;

import com.hlingsoft.kkh.constant.UserConstant;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 用户实体
 * 
 * @author kk
 * 
 */

public class User  {

	private long id;
	private String picSmall;
	private String name;
	private String email;
	private String nickname;
	private String phone;
	private String distance;
    private String currentEvent;
	private UserConstant.Gender gender;
    
    /**
     * add for邀请时间
     */
    private String confirmTime;
    
    /**
     *  用户标示，1 为et好友  0 为通讯录好友
     */
    private int iseter;
    
	
	public String getCurrentEvent() {
		return currentEvent;
	}
	public void setCurrentEvent(String currentEvent) {
		this.currentEvent = currentEvent;
	}
	public String getDistance() {
		return distance;
	}
	public void setDistance(String distance) {
		this.distance = distance;
	}
	
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getPicSmall() {
		return picSmall;
	}
	public void setPicSmall(String picSmall) {
		this.picSmall = picSmall;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getNickname() {
		return nickname;
	}
	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	public int getIseter() {
		return iseter;
	}
	public void setIseter(int iseter) {
		this.iseter = iseter;
	}
	public String getConfirmTime() {
		return confirmTime;
	}
	public void setConfirmTime(String confirmTime) {
		this.confirmTime = confirmTime;
	}


	public UserConstant.Gender getGender() {
		return gender;
	}

	public void setGender(UserConstant.Gender gender) {
		this.gender = gender;
	}
	
	
	private String city;
	private String region;
	private Date createTime;
	private String pic;
	private  UserConstant.Type type;
	private  UserConstant.Status status;
	private String pwd;
	
	private int amount;
	private int cost;
	
	private String company;
	private String wechat;
	private String udid;
	private Date birthday;
	private String birthdayStr;
	
	private String tag;
	private String signature;//运动 聚餐
	private int level;//LV 1
	private int popularity;//1颗星  2颗星  3颗星
	private int score;//积分
	
	
	private float latitude;//纬度
	private float longitude;//经度
	private boolean forFriend=false;
	
	
	
	
	public String getBirthdayStr() {
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		if(this.birthday!=null)
		return sf.format(this.birthday);
		else
			return "";
	}

	public void setBirthdayStr(String birthdayStr) {
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		this.birthdayStr = birthdayStr;
		try {
			if(this.birthdayStr!=""){
				this.birthday=sf.parse(this.birthdayStr);
			}  
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}

	 
	 
	
	
	public boolean isForFriend() {
		return forFriend;
	}

	public void setForFriend(boolean forFriend) {
		this.forFriend = forFriend;
	}

	public float getLatitude() {
		return latitude;
	}

	public void setLatitude(float latitude) {
		this.latitude = latitude;
	}

	public float getLongitude() {
		return longitude;
	}

	public void setLongitude(float longitude) {
		this.longitude = longitude;
	}

	
 	
	
	
 

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public int getPopularity() {
		return popularity;
	}

	public void setPopularity(int popularity) {
		this.popularity = popularity;
	}

	public String getSignature() {
		return signature;
	}

	public void setSignature(String signature) {
		this.signature = signature;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getUdid() {
		return udid;
	}

	public void setUdid(String udid) {
		this.udid = udid;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getWechat() {
		return wechat;
	}

	public void setWechat(String wechat) {
		this.wechat = wechat;
	}


	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	public int getCost() {
		return cost;
	}

	public void setCost(int cost) {
		this.cost = cost;
	}

	public UserConstant.Status getStatus() {
		return status;
	}

	public void setStatus(UserConstant.Status status) {
		this.status = status;
	}

	public UserConstant.Type getType() {
		return type;
	}

	public void setType(UserConstant.Type type) {
		this.type = type;
	}

 
	public String getPic() {
		return pic;
	}

	public void setPic(String pic) {
		this.pic = pic;
	}



	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getRegion() {
		return region;
	}

	public void setRegion(String region) {
		this.region = region;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}


	public String getPwd() {
		return pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	 /**
     * 如果对象类型是User 的话 则返回true 去比较hashCode值
     */
    @Override
    public boolean equals(Object obj) {
        if(obj == null) return false;
        if(this == obj) return true;
        if(obj instanceof User){ 
            User user =(User)obj;
            if(user.getId() == this.getId() ) return true;
            }
        return false;
    }
 
 
 
    /**
     * 重写hashcode 方法，返回的hashCode 不一样才认定为不同的对象
     */
    @Override
    public int hashCode() {
//      return id.hashCode(); // 只比较id，id一样就不添加进集合
        return String.valueOf(this.getId()).hashCode() * this.getName().hashCode();
    }

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}
	
    
    
 
	
}
